home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / T / Terminal 1.7.cpt / Terminal scripts / Log into Beach Box.s < prev    next >
Text File  |  1989-11-06  |  1KB  |  48 lines

  1. /*
  2.     Terminal 1.7
  3.     "Log into Beach Box.s"
  4. */
  5.  
  6. check(char *command, char *reply)    /* Send command and wait for reply */
  7. {
  8.     type(command);
  9.     return prompt(reply, 1800);    /* Timeout = 30 sec */
  10. }
  11.  
  12. answer(char *hint, char *command)    /* Wait for prompt and send command */
  13. {
  14.     int result;
  15.  
  16.     if (result = prompt(hint, 1800))
  17.         return result;    /* Timeout or cancel */
  18.     pause(30);            /* Don't type immediatly */
  19.     type(command);
  20.     return 0;
  21. }
  22.  
  23. main()
  24. {
  25.     int go = 1;
  26.  
  27.     while (go) {
  28.         if (check("ATDP398144\r", "CONNECT"))    /* Dial */
  29.             break;
  30.         if (answer("Press RETURN...", "\r"))    /* Wait for "Press RETURN..." */
  31.             break;
  32.         if (answer("<N>onstop else next..", "N"))
  33.             break;
  34.         if (answer("enter '0'>>", "23\r"))        /* Enter account number */
  35.             break;
  36.         if (answer("PassWord?", "...\r"))        /* Enter password */
  37.             break;
  38.         go = 0;            /* Ok */
  39.     }
  40.     if (go) {        /* Timeout or cancel */
  41.         setdtr(0);    /* Negate DTR: modem hangs up */
  42.         pause(60);    /* Wait one second */
  43.         setdtr(1);    /* Assert DTR: now back in command mode */
  44.         beep();        /* 2 beeps if error */
  45.     }
  46.     beep();
  47. }
  48.